﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EventUnsubscriber : MonoBehaviour
{
    private readonly List<EventHandle> _handles = new List<EventHandle>();

    public void Register(EventHandle handle)
    {
        _handles.Add(handle);
    }

    private void OnDestroy()
    {
        foreach (var h in _handles)
            h.Unsubscribe();
    }
}
